package cn.lili.common.utils;

import java.util.List;
import java.util.Random;

public class RandomSelection {


    /**
     * 从List<String>中随机选择一个
     *
     * @param stringList
     */
    public static String getRandomElement(List<String> stringList) {
        if (stringList == null || stringList.isEmpty()) {
            return null;
        }

        Random random = new Random();
        int randomIndex = random.nextInt(stringList.size());

        return stringList.get(randomIndex);
    }
}